# *_*coding:utf-8 *_*
# @Author : Reggie
# @Time : 2022/1/17 17:58

def check(node_speed_max, node_speed_min, log=False):
    if log:
        print(node_speed_max < 0 or node_speed_min < 0)
        print(node_speed_max > 0 and (node_speed_max > 150 or node_speed_max < 30))
        print(node_speed_max < 30 and (node_speed_min > 0 or node_speed_max > 0))
        print(0 < node_speed_min < 30 or 0 < node_speed_max < 30)
        print(0 < node_speed_min >= node_speed_max > 0)
    if any(
            [
                # node_speed_max 和 node_speed_min 不能小于0
                node_speed_max < 0 or node_speed_min < 0,
                # node_speed_max 不能大于 150, 不能小于 30
                node_speed_max > 0 and (node_speed_max > 150 or node_speed_max < 30),
                # node_speed_min 等于 0 或 不小于 30
                node_speed_max < 30 and (node_speed_min > 0 or node_speed_max > 0),
                # node_speed_min 和 node_speed_max 必须大于零并不能小于 30
                0 < node_speed_min < 30 or 0 < node_speed_max < 30,
                # node_speed_min 不能大于 node_speed_max
                0 < node_speed_min >= node_speed_max > 0
            ]
    ):
        return False
    else:
        return True


def check(node_speed_max, node_speed_min, log=False):
    if any(
            [
                # 两个都配置的情况，
                30 <= node_speed_max <= 150 and
                30 <= node_speed_min <= 150 and
                node_speed_min < node_speed_max,
                # 两个都为零
                node_speed_max == 0 and node_speed_min == 0,
                # 一个为零，一个在 30 ~ 150
                node_speed_max == 0 and
                30 <= node_speed_min <= 150,
                node_speed_min == 0 and
                30 <= node_speed_max <= 150,
            ]
    ):
        return True
    else:
        return False


def t1():
    out = check(30, 31, log=True)
    assert check(0, 0) is True
    for i in range(160):
        for j in range(160):
            result = check(i, j)
            if 0 < j < 30:
                assert result is False
            if 0 < i < 30:
                assert result is False
            if j > i > 0 and j > 0:
                assert result is False
            if j > i > 0 and j > 0:
                assert result is False
            if 0 < i < 30 or 0 < j < 30:
                assert result is False
            if 0 == i and j != 0 and j > i:
                assert result is False
            if result:
                print(f"result: {result} node_speed_max: {i} node_speed_min: {j}")


def t2():
    lines = []
    for i in range(160):
        for j in range(160):
            result = check(i, j)
            if result:
                line = f"result: {result} node_speed_max: {i} node_speed_min: {j}"
                print(line)
                lines.append(line)

    # with open("result.txt", "w", encoding="utf-8") as f:
    #     f.writelines(lines)


if __name__ == '__main__':
    t2()
